home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11556 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.4 KB  |  37 lines

  1. Newsgroups: comp.lang.c
  2. Path: new-news.sprintlink.net!eskimo!news
  3. From: mag@eskimo.com (mAg)
  4. Subject: Re: What happens on realloc() failure?
  5. X-Nntp-Posting-Host: tia1.eskimo.com
  6. Message-ID: <DotG06.4n8@eskimo.com>
  7. Sender: news@eskimo.com (News User Id)
  8. Organization: *.*
  9. X-Newsreader: WinVN 0.93.10
  10. References: <Pine.SOL.3.91-941213.960322192958.24127A-100000@aidan.ncl.ac.uk>
  11. Date: Mon, 25 Mar 1996 09:07:17 GMT
  12.  
  13. In article <Pine.SOL.3.91-941213.960322192958.24127A-100000@aidan.ncl.ac.uk> (Fri, 22 Mar 
  14. 1996 19:37:44 +0000), T.W.Seddon@ncl.ac.uk says :
  15. >
  16. << stuff deleted >>
  17. >
  18. >Since realloc() returns NULL on failure, is it safe to use the pointer to 
  19. >the malloc()ed area I was trying to resize? Or will the old area have 
  20. >been freed by free() and now be unusable? What does the ANSI standard 
  21. >have to say about this? I've never seen anything about this point before 
  22. >(although if it's in the FAQ I apologise, I must have missed it :-( )
  23. << stuff deleted >>
  24.  
  25. Article 7.10.3.4 ANSI C specifically states 
  26. ".... If the object cannot be allocated, the object pointed to by ptr is unchanged. ..."
  27.  
  28. -- 
  29. /* --------------------------------------------------------
  30.                       MAG@ESKIMO.COM
  31. http://www.eskimo.com/~mag/index.html
  32. ***********************************************************
  33. To understand recursion one must first understand recursion
  34. ***********************************************************
  35. -------------------------------------------------------- */
  36.  
  37.